import java.util.Random;
import java.util.Scanner;

public class DoubleColorBall {
    public static void main(String[] args) {
        int[] selectedRedBall = new int[6];
        int selectedBlueBall;
        int[] inputRedBall = new int[6];
        int inputBlueBall;
        int num = 0; //猜中红球个数
        boolean isBlueBall=false; //蓝球是否猜中
        Random r = new Random();  //随机一个数
        selectedBlueBall = r.nextInt(16)+1;  //随机1-16中的一个数
        System.out.println("系统选中的蓝球为："+selectedBlueBall);
        for (int i = 0;i<selectedRedBall.length;i++){  //for循环赋值
            selectedRedBall[i]=r.nextInt(33)+1;
        }
        System.out.println("系统选中的红球为：");
        for (int i = 0;i<selectedRedBall.length;i++){
            System.out.println(selectedRedBall[i]);
        }
        System.out.println("开始选双色球");
        Scanner scanner = new Scanner(System.in);
        for (int i = 0;i<selectedRedBall.length;i++){
         System.out.println("第"+(i+1)+"个红球");
         inputRedBall[i]= scanner.nextInt();
         while (inputRedBall[i] < 1||inputRedBall[i] > 33){  //while循环判断输入是否在范围内
             System.out.println("红球的范围在1-33，请重新输入1-33中的数");
             inputRedBall[i] = scanner.nextInt();
         }
         if (inputRedBall[i] == selectedRedBall[i]){  //循环比较
             num += 1;    //如果用户选的与随机的数相同，num加1
         }
     }
        System.out.println("蓝球:");
        inputBlueBall = scanner.nextInt();
        while(inputBlueBall < 1||inputBlueBall>16){   //while循环判断输入是否在范围内
            System.out.println("蓝球的范围在1-16，请重新输入1-16中的数");
            inputBlueBall = scanner.nextInt();
        }
        if (inputBlueBall == selectedBlueBall){
            isBlueBall = true;
        }
        if (num == 6&&isBlueBall == true){
            System.out.println("恭喜你，中了一等奖500万");
        }else if (num == 6&&isBlueBall == false){
            System.out.println("恭喜你，中了二等奖100万");
        }else if (num == 5&&isBlueBall == true){
            System.out.println("恭喜你，中了三等奖3000");
        }else if ((num == 4&&isBlueBall == true)||num == 5){
            System.out.println("恭喜你，中了四等奖200");
        }else if ((num == 3&&isBlueBall == true)||num == 4){
            System.out.println("恭喜你，中了五等奖10");
        }else if (isBlueBall == true){
            System.out.println("恭喜你，中了六等奖5");
        }else {
            System.out.println("很遗憾，你没有中奖");
        }


    }
}
